<?php
class ques_detail{
	var $ques_info=false;
	function __construct() {
		if(!isset($_GET['id'])) js_alert('没有找到该条目信息！','close');
		global $user;
		$gm_id=$user->id;
		$id=$_GET['id'];
		
		$ques_id=$_GET['id'];
		$sql="select gm_id,gm_back from question_info where id=$ques_id";
		$res=sql_get_one($sql,__LINE__);
		$old_gm_back=$res['gm_back'];
			
		$sql="select * from question_info where id=$id";
		$res=sql_get_one($sql,__LINE__);
		if(!$res)  js_alert('没有找到该条目信息！','close');
		$this->ques_info=$res;
		$this->id=$this->ques_info['id'];
		
		//get user_name
		$user_id=$this->ques_info['user_id'];
		$sql="select nick_name from user_info where id=$user_id";
		$res=sql_get_one($sql,__LINE__);
		
		//get question class
		$this->ques_info['user_name']=$res['nick_name'];
		$class_id=$this->ques_info['class_id'];
		$sql="select * from question_class where class_id=$class_id" ;
		$res=sql_get_one($sql,__LINE__);
		$this->ques_info['class_1']=$res['title'];
		$parent_id=$res['parent_id'];
		$sql="select title from question_class where class_id=$parent_id";
		$res=sql_get_one($sql,__LINE__);
		$this->ques_info['class_0']=$res['title'];
		
		//get pic
		$ques_id=$this->id;
		$sql="select id from question_pic where question_id=$ques_id";
		$res=sql_get_arr($sql,__LINE__);
		if($res==false) $this->ques_info['pic']['count']=0;
		else {
			$this->ques_info['pic']=$res;
			$this->ques_info['pic']['count']=$res['sql']['count'];
		}

		//get gm name
		if($this->ques_info['gm_id']!=0) {
			$gm_id=$this->ques_info['gm_id'];
			$sql="select gm_name from gm_user where id=$gm_id";
			$res=sql_get_one($sql,__LINE__);
			$this->gm_name=$res['gm_name'];
		}
		if($this->ques_info['high_gm_id']!=0) {
			$high_gm_id=$this->ques_info['high_gm_id'];
			$sql="select gm_name from gm_user where id=$high_gm_id";
			$res=sql_get_one($sql,__LINE__);
			$this->high_gm_name=$res['gm_name'];
		}
		
		//get back time
		if($this->ques_info['back1_time']=='') $this->ques_info['back1_time']=get_date_time();
		
		$this->ques_info['replay_flag']='gm处理中..';
		if($this->ques_info['solution_flag']==1) $this->ques_info['replay_flag']='已经解决';
		if($this->ques_info['solution_flag']==3) $this->ques_info['replay_flag']='GM（'.$this->gm_name.'）升级处理中..';
		if($this->ques_info['solution_flag']==4) $this->ques_info['replay_flag']='等待质检..';
		
		if($this->ques_info['solution_flag']==3 && $this->ques_info['high_gm_back']=='') $this->wait_high_gm_back=1;
		else $this->wait_high_gm_back=0;
		if(($this->ques_info['solution_flag']==0 || $this->ques_info['solution_flag']==2) && $this->ques_info['high_gm_back']=='') $this->show_to_hign_gm=1;
		else $this->show_to_hign_gm=0;
		
		
	}
}
?>